/**
 * Created by Administrator on 2017/6/27.
 */
define(['jquery', 'vue', 'mui'], function ($, Vue, mui) {
    var order = "id";
    var sort = "desc";
    var data = {
        'order': order,
        "sort": sort,
        'page': 1
    };

    mui.init();
    var vue = new Vue({
        el: '#order_div',
        data: {
            items: [],
            info: []
        },
        methods: {
            delivery: function (id) {//开始配送
                $.post(delivery_url, {order_id: order_id},
                    function (result) {
                        if (result.code === 1) {
                            mui.alert("订单开始配送！!", '系统提示', function () {
                                location.reload();
                            }, 'div');
                        }else {
                            mui.alert(result.msg, '系统提示', function () {
                                location.reload();
                            }, 'div');
                        }
                    });
            }
            // cash_delivery: function (id) {//货到付款收款
            //     $.post(cash_delivery_url, {order_id: order_id},
            //         function (result) {
            //             if (result.code === 1) {
            //                 mui.alert("收款成功!", '系统提示', function () {
            //                     location.reload();
            //                 }, 'div');
            //             }
            //         });
            // }
        }
    });
    getData();
    function getData() {
        $.get(list_url, {order_id: order_id},
            function (result) {
                if (result.code === 1) {
                    vue.items = result.data.list;
                    vue.info = result.data.info;
                }
            });
    }

});